<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div>
    <el-form ref="form" :model="check_step" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 选择工序 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="24">
            <el-form-item label="工序" prop="">
              {{check_step.process_id}}
              <el-button @click="popFlowChartOneProcess('','process_id')" type="success" size="mini"><i class="fa fa-edit"></i>选择</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-button @click="i_step('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
    </el-form>
    <el-dialog :visible.sync="FlowChartOneProcessVisible" append-to-body>
      <FlowChartOneProcess v-if="FlowChartOneProcessVisible" ref="FlowChartOneProcess" :popparams="popparams"> </FlowChartOneProcess>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import FlowChartOneProcess from "@/views/mes/product/FlowChartOneProcess";
  export default {
    name: 'StartProcessRang',
    components: {
      FlowChartOneProcess,
    },
    props: ['popparams'],
    data() {
      return {
        FlowChartOneProcessVisible: false,
        FlowChartOneProcessValue: null,
        FlowChartOneProcessDesc: null,
        vueparams: this.getVUEParams(""),
        check_step: {
          process_id: null,
        },
        loading: false,
        rules: {}
      }
    },
    created() {},
    updated() {},
    mounted() {},
    methods: {
      i_step(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/mes/product/TechnologyAction/i_step?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.$router.replace("/redirect" + this.$route.fullPath);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
      popFlowChartOneProcess(desc, value) {
        this.FlowChartOneProcessVisible = true;
        this.FlowChartOneProcessDesc = desc;
        this.FlowChartOneProcessValue = value;
      },
      closeFlowChartOneProcess(value, desc) {
        this.FlowChartOneProcessVisible = false;
        this.$set(this.check_step, this.FlowChartOneProcessDesc, desc);
        this.$set(this.check_step, this.FlowChartOneProcessValue, value);
      },
    },
  }
</script>
